home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / MacRuntime.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  4.2 KB  |  124 lines  |  [TEXT/MPS ]

  1. /*
  2.  * MacRuntime.h -- faccess(), fcntl(), and open() mode flags
  3.  *
  4.  * Portions copyright American Telephone & Telegraph
  5.  * Used with permission, Apple Computer Inc. (1985,1988,1990,1992-1994)
  6.  * All rights reserved.
  7.  *
  8.  * Warning:  This interface is NOT a part of the ANSI C standard.
  9.  *             We do NOT claim to be POSIX compliant.
  10.  *             If you want your code to be portable, don't use this interface.
  11.  */
  12.  
  13. /* Conditional Macros:
  14.  *    UsingStaticLibs    - for CFM-68K:  Insures that #pragma lib_export is never used.
  15.  *    UsingSharedLibs    - for CFM-68K:  Insures that all functions and data items are
  16.  *                                    marked as exported
  17.  *    <none>            - for CFM-68K:    Data items are exported using #pragma lib_export,
  18.  *                                    functions are not.  Causes excess code to be
  19.  *                                    generated for data references to static libraries
  20.  *                                    and causes the linker to generate glue for
  21.  *                                    references to shared library routines.
  22.  *    The preceeding macros may not both be defined in the same compilation.
  23.  */
  24. #if defined (UsingStaticLibs) && defined (UsingSharedLibs)
  25.     #error "Only one of the conditional macros 'UsingStaticLibs' and 'UsingSharedLibs' may be defined in a compilation"
  26. #endif
  27.  
  28. #ifndef __MACRUNTIME__
  29. #define __MACRUNTIME__    1
  30.  
  31. #pragma once
  32.  
  33. #ifndef __TYPES__
  34. #include <types.h>
  35. #endif
  36.  
  37. #ifndef __FILES__
  38. #include <Files.h>
  39. #endif
  40.  
  41. #ifndef __ALIASES__
  42. #include <Aliases.h>
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. /* Global Variables */
  50.  
  51. #ifdef __CFM68K__
  52.     #ifndef UsingStaticLibs
  53.         #pragma lib_export on
  54.     #endif
  55. #endif
  56.  
  57. extern int StandAlone;
  58.  
  59. #ifdef __CFM68K__
  60.     #ifndef UsingSharedLibs
  61.         #pragma lib_export off
  62.     #endif
  63. #endif
  64.  
  65. /* Utility Routines */
  66.  
  67. pascal Boolean TrapAvailable (short TrapNumber);
  68.  
  69. #ifdef __CFM68K__
  70.  
  71. /* 68K CFM Runtime and Shared Library Utility Routines */
  72.  
  73. /* LinkupQDGlobals is called from the default CFM init routine %__INIT.
  74. ** Please Refer to FragLoad.h for the prototype of custom init routines.
  75. ** If you create your own init routine you must call LinkupQDGlobals before
  76. ** any other code you write (and that code MAY NOT call Quickdraw)
  77. **
  78. ** LinkupQDGlobals purpose is to create a linked list of all the "per context" 
  79. ** A5 Worlds in a given application context so that QuickDraw will find a 
  80. ** "QD globals" pointer at A5+0 no matter which A5World is currently ref'd by A5.
  81. **
  82. ** The linked list built by LinkupQDGlobals uses the lomem global CurrentA5
  83. ** and builds the list thru the qd Globals pointers at A5+0, IF InitGraf() has
  84. ** NOT yet been called; Otherwise LinkupQDGlobals just copies the value of the 
  85. ** QuickDraw globals pointer (at the location pointed to by CurrentA5) into 
  86. ** the A5+0; i.e. into the A5World of the code fragment containing LinkupQDGlobals.
  87. **
  88. ** LinkupQDGlobals is and MUST REMAIN a staticly linked routine, called by the
  89. ** init routine of each separate code fragment. It may not be exported or shared.
  90. **
  91. ** LinkupQDGlobals will only return an error if it is called and the A5World
  92. ** referenced by the lomem pointer CurrentA5 is NOT a NuRuntime A5World AND 
  93. ** QuickDraw has NOT been initialized.  This condition can occur ONLY if an 
  94. ** "old"/"Classic" 68K model application is attempting to use the CFM API directly.
  95. **
  96. ** The routine BindQDGlobalsList must be called IMMEDIATELY before the application
  97. ** initialization call of QuickDraw's InitGraf() routine, WITH THE SAME parameter 
  98. ** passed to InitGraf.  BindQDGlobalsList resolves the linked list of A5Worlds
  99. ** created by LinkupQDGlobals.  This will cause all the A5Worlds to have a valid
  100. ** pointer at A5+0 to the same QuickDraw Globals.
  101. **
  102. ** Shared Libraries that have "Global" sharing (i.e 1 copy of data in system heap)
  103. ** must have customized Init Routines and probably will require a private copy of 
  104. ** the quickdraw globals that are created manually and A5+0 initialized without
  105. ** calling QuickDraw's InitGraf() IF such libraries are to call QuickDraw (directly
  106. ** or indirectly) at all.  The most likely case of a "data only" globally shared 
  107. ** fragment will not need to have an init routine that fixes up A5+0, since no code
  108. ** will ever execute with A5 referencing its A5World.
  109. **
  110. */ 
  111.  
  112. pascal OSErr LinkupQDGlobals(void);
  113. pascal void BindQDGlobalsList(void* globalPtr);
  114.  
  115. #ifdef UsingSharedLibs
  116.     #pragma lib_export off
  117. #endif
  118.  
  119. #endif
  120.  
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif